//
//  ZZBottomSelectView.m
//  ZZBlue
//
//  Created by stonesMonkey on 2017/9/12.
//  Copyright © 2017年 stonesMonkey. All rights reserved.
//

#import "ZZBottomSelectView.h"

@interface ZZBottomSelectView()

@property (weak, nonatomic) IBOutlet UIButton *btn1;

@property (weak, nonatomic) IBOutlet UIButton *btn2;

@property (weak, nonatomic) IBOutlet UIButton *btn3;

@property (weak, nonatomic) IBOutlet UIView *bgLineImage;



@end

@implementation ZZBottomSelectView

- (void)awakeFromNib {
    
    [super awakeFromNib];
//    
//    "HOME_LongLight" = "常亮";
//    "HOME_GradualChange" = "渐变";
//    "HOME_StartLight" = "频闪";
    
    [_btn1 setTitle:NSLocalizedString(@"HOME_LongLight", nil) forState:UIControlStateNormal];
    [_btn2 setTitle:NSLocalizedString(@"HOME_GradualChange", nil) forState:UIControlStateNormal];
    [_btn3 setTitle:NSLocalizedString(@"HOME_StartLight", nil) forState:UIControlStateNormal];
    
    _btn1.layer.cornerRadius = 16.5;
    _btn1.layer.borderWidth = 2;
    _btn1.layer.borderColor = [UIColor redColor].CGColor;
    _btn1.layer.masksToBounds = YES;
    
    _btn2.layer.cornerRadius = 16.5;
    _btn2.layer.borderWidth = 2;
    _btn2.layer.borderColor = [UIColor clearColor].CGColor;
    _btn2.layer.masksToBounds = YES;
    
    _btn3.layer.cornerRadius = 16.5;
    _btn3.layer.borderWidth = 2;
    _btn3.layer.borderColor = [UIColor clearColor].CGColor;
    _btn3.layer.masksToBounds = YES;
    
//    self.layer.cornerRadius = 16.5;
//    self.layer.borderColor = [[UIColor colorWithRed:1 green:0 blue:0 alpha:0.5] CGColor];
//    self.layer.borderWidth = 1;
    
    
    
    self.bgLineImage.layer.cornerRadius = 16.5;
    self.bgLineImage.layer.borderWidth = 2;
    self.bgLineImage.layer.borderColor = [UIColor colorWithRed:31/255.0 green:8/255.0 blue:10/255.0 alpha:1].CGColor;
}

- (void)TypeTwo {
    
    [_btn1 setTitle:NSLocalizedString(@"MUSIC_SignColor", nil) forState:UIControlStateNormal];
    [_btn2 setTitle:NSLocalizedString(@"MUSIC_MoreColor", nil) forState:UIControlStateNormal];
    [_btn3 setTitle:NSLocalizedString(@"MUSIC_Change", nil) forState:UIControlStateNormal];
}

- (IBAction)btnClick:(UIButton *)sender {
    
    NSInteger tag = sender.tag;
    _btn1.selected = NO;
    _btn2.selected = NO;
    _btn3.selected = NO;
    _btn1.layer.borderColor = [UIColor clearColor].CGColor;
    _btn2.layer.borderColor = [UIColor clearColor].CGColor;
    _btn3.layer.borderColor = [UIColor clearColor].CGColor;
    
    if(tag == 1000) {
        _btn1.selected = YES;
        
        _btn1.layer.borderColor = [UIColor redColor].CGColor;
        
    } else if (tag == 1001) {
        
        _btn2.selected = YES;
        _btn2.layer.borderColor = [UIColor redColor].CGColor;
    } else if (tag == 1002) {
        
        _btn3.selected = YES;
        _btn3.layer.borderColor = [UIColor redColor].CGColor;
    }
    
    if (self.selectBtnClick) {
        
        self.selectBtnClick(tag - 1000);
    }
}
- (void)setIndex:(NSInteger)index {
    
    if (index == 0) {
        [self btnClick:self.btn1];
    } else if (index == 1) {
        [self btnClick:self.btn2];
    } else if (index == 2) {
        
        [self btnClick:self.btn3];
    }
    
}




@end
